<?php


namespace Tbf\Bundle\YntAuthBundle\Denglu;


use Tbf\Component\Path\PathFunction;

class Config {
    protected $app_key;
    protected $app_secret;
    protected $denglu_url_base = 'http://open.denglu.cc';
    protected $api_path = array(
        'bind' => '/api/v3/bind',
        'unbind' => '/api/v3/unbind',
        'login' => '/api/v3/send_login_feed',
        'getUserInfo' => '/api/v4/user_info',
        'share' => '/api/v4/share',
        'getMedia' => '/api/v3/get_media',
        'unbindAll' => '/api/v3/all_unbind',
        'getBind' => '/api/v3/bind_info',
        'getInvite' => '/api/v3/friends',
        'getRecommend' => '/api/v3/recommend_user',
        'sendInvite' => '/api/v3/invite',
        'latestComment' => '/api/v4/latest_comment', // 最新评论
        'getComments' => '/api/v4/get_comment_list', // 评论列表，用于数据本地化
        'getCommentState' => '/api/v4/get_change_comment_ids' // 评论状态列表
    );
    function __construct($app_key,$app_secret){
        $this->app_key = $app_key;
        $this->app_secret = $app_secret;
    }
    /**
     * @param mixed $app_key
     */
    public function setAppKey($app_key)
    {
        $this->app_key = $app_key;
    }

    /**
     * @return mixed
     */
    public function getAppKey()
    {
        return $this->app_key;
    }

    /**
     * @param mixed $app_secret
     */
    public function setAppSecret($app_secret)
    {
        $this->app_secret = $app_secret;
    }

    /**
     * @return mixed
     */
    public function getAppSecret()
    {
        return $this->app_secret;
    }

    /**
     * @param string $denglu_url_base
     */
    public function setDengluUrlBase($denglu_url_base)
    {
        $this->denglu_url_base = $denglu_url_base;
    }

    /**
     * @return string
     */
    public function getDengluUrlBase()
    {
        return $this->denglu_url_base;
    }
    public function getApiUrl($name){
        return PathFunction::urlJoin($this->denglu_url_base,$this->api_path[$name]);
    }
}